#@common() #define main()
<div class="main-content">
	<fieldset class="layui-elem-field">
		<legend>用户列表</legend>
		<div class="layui-field-box">
			<table class="layui-table">
				<colgroup>
					<col width="150">
					<col width="150">
					<col width="200">
					<col>
				</colgroup>
				<thead>
					<tr>
						<th>用户名</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					#for(user:userList.getDataList())
					<tr>
						<td>#(user.username)</td>
						<td>#hasPermission("user:offUser") <a
							class="layui-btn layui-btn-danger layui-btn-small off"
							username="#(user.username)"><i class="layui-icon"></i>下线</a>
							#end
						</td>
					</tr>
					#end
				</tbody>
			</table>
			#@paginate(userList, "/user/list")#(userList.pages)....#(userList.total)
		</div>
	</fieldset>
</div>
#end #define script()

<script>
	layui.use([ 'form', 'element', 'laydate' ], function() {

		$('.off').on("click", function() {
			var $this = $(this);
			var username = $this.attr('username');
			if (username == "admin") {
				layer.msg("管理员不能下线")
				return false;
			}
			$.post("/admin/user/offUser", {
				'username' : username
			}, function(rep) {
				if (rep.isOk) {
					layer.msg("下线成功")
					$this.parent().parent().remove();
				} else {
					layer.msg(rep.msg)
				}
			})
		})
	});
</script>
#end
